// 角色相关路由配置

const Router = require('@koa/router');
const mongoose = require('mongoose');
const CharacterModel = mongoose.model('Character');

const router = new Router({
  prefix: '/character',
});

// 角色列表接口
router.get('/list', async (ctx) => {
  console.log('--> 调用接口 get /character/list');
  const list = await CharacterModel.find().exec();
  ctx.body = {
    msg: '获取角色列表成功',
    code: 1,
    data: list,
  };
});
module.exports = router;
